package lol.clann.minecraft.springboot.api.bukkit.utils;

import org.bukkit.Material;
import org.bukkit.block.Block;

/**
 *
 * @author pyz
 * @date 2019/5/12 10:34 PM
 */
public interface BlockUtils {
    /**
     * 若方块不是null且不是空气,返回true
     * @param block
     * @return
     */
    default public boolean isEmpty(Block block) {
        return block == null || block.getType() == Material.AIR;
    }

    /**
     * 判断方块是不是液体方块
     * @param block
     * @return
     */
    boolean isFliud(Block block);

    /**
     * 判断方块是否是一个容器
     *
     * @param block
     * @return
     */
    boolean isInventory(Block block);

    /**
     * 将该位置的Block和TileEntity序列化成NBTTagCompound
     * @param block
     * @param <T>
     * @return
     */
    <T> T toNBTTagCompound(Block block);

    /**
     * 获取对应的NMSBlock
     * @param block
     * @param <T>
     * @return
     */
    <T> T toNMS(Block block);

}
